<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>十个数字</title>
    <script>
        let year = () => {
            let arr = [];
            let i = 0, odd = 0, even = 0,oddHe = 0, evenHe = 0;
            do {
                let sub = prompt("请输入"+(i+1)+"个数字");
                //sub=number(sub);
                if (isNaN(sub)) {
                    alert("请输入数字");
                    break;
                } else {
                    /*if (sub%1!=0){
                        alert("请输入整数");
                        break;*/
                    sub=Number(sub)
                    }
                /*}*/
                arr.push(sub);
                if (sub%2===0){
                    even++;
                    evenHe=evenHe+sub;
                }else {
                    odd++;
                    oddHe=oddHe+sub;
                }
                i++
            } while (i < 4);
            document.write("你输入的数是"+arr+"<br>");
            document.write("你输入的偶数有"+even+"个"+"<br>");
            document.write("你输入的奇数有"+odd+"个"+"<br>");
            document.write("你输入的奇数和是"+oddHe+"<br>");
            document.write("你输入的偶数和是"+evenHe+"<br>");
        };
        year()
    </script>
</head>
<body>
<!--<button ondblclick="year()">双击显示</button>-->
</body>
</html>